Checkout Pipeline
The checkout pipeline is run after payments has successfully been placed for an order whether it being a credit card payment or an invoice payment type. The checkout pipeline converts the basket into an actual order which includes assigning order numbers, sending confirmation emails, removing the basket state, and making sure the customer is known in your system.
This is a great extension point for when orders are placed, but do remember the customer will wait for every task as this is typically run between accepting payments and sending the customer to the confirmation page. So any long-running tasks like integration to separate systems should most likely run at a later point where the customer is not actually affected by the wait time.
Tasks and execution order
Pipeline implementation
- windsor component id
Checkout
- type
Ucommerce.Pipelines.Transactions.Baskets.Checkout.CheckoutPipeline
- Description
Pipeline run when completing checkout process
Tasks and execution order
ValidatePaymentsMadeAgainstOrderTotalTask
- Windsor component id
Checkout.ValidatePaymentsMadeAgainstOrderTotal
- Type
Ucommerce.Pipelines.Transactions.Baskets.Checkout.ValidatePaymentsMadeAgainstOrderTotalTask
- Description
Validates that sufficient payments are made on the order to cover the order total.
AssignOrderNumberTask
- Windsor component id
Checkout.AssignOrderNumber
- Type
Ucommerce.Pipelines.Transactions.Baskets.Checkout.AssignOrderNumberTask
- Description
Assigns an order number to the order if none is present
CreateCustomerTask
- Windsor component id
Checkout.CreateCustomer
- Type
Ucommerce.Pipelines.Transactions.Baskets.Checkout.CreateCustomerTask
CreateMemberForCustomerTask
- Windsor component id
Checkout.CreateMemberForCustomer
- Type
Ucommerce.Pipelines.Transactions.Baskets.Checkout.CreateMemberForCustomerTask
- Description
Sets memberId on customer.
ConvertBasketToPurchaseOrderTask
- Windsor component id
Checkout.ConvertBasketToPurchaseOrder
- Type
Ucommerce.Pipelines.Transactions.Baskets.Checkout.ConvertBasketToPurchaseOrderTask
- Description
Converts a to a PurchaseOrder by changing the order status to "New Order" (order status id 2)
AddAuditTrailForCurrentOrderStatusTask
- Windsor component id
Checkout.AddAuditTrailForCurrentOrderStatus
- Type
Ucommerce.Pipelines.Common.AddAuditTrailForCurrentOrderStatusTask
-
Description
Adds audit trail for order. Please note that the PurchaseOrder must have an OrderStatus set and it must have an OrderId assigned, ie. it must have been saved at least once before this task is run.
SetVoucherUsesTask
- Windsor component id
Checkout.SetVoucherUses
- Type
Ucommerce.Pipelines.Transactions.Baskets.Checkout.SetVoucherUsesTask
- Description
Updates uses on vouchers present on the PurchaseOrder at runtime.
ClearBasketInformationTask
- Windsor component id
Checkout.ClearBasketInformation
- Type
Ucommerce.Pipelines.Transactions.Baskets.Checkout.ClearBasketInformationTask
- Description
Clears basket information for the current user and effectively assigns the customer a new
SavePurchaseOrderTask
- Windsor component id
Checkout.SavePurchaseOrder
- Type
Ucommerce.Pipelines.Common.SavePurchaseOrderTask
FeedOrderPlacedTask
- Windsor component id
Checkout.Feed.OrderPlaced
- Type
Ucommerce.Pipelines.Transactions.Baskets.Checkout.FeedOrderPlacedTask
FeedReturningCustomerTask
- Windsor component id
Checkout.Feed.ReturningCustomer
- Type
Ucommerce.Pipelines.Transactions.Baskets.Checkout.FeedReturningCustomerTask
FeedNewCustomerTask
- Windsor component id
Checkout.Feed.NewCustomer
- Type
Ucommerce.Pipelines.Transactions.Baskets.Checkout.FeedNewCustomerTask
FeedCampaignTriggeredTask
- Windsor component id
Checkout.Feed.CampaignTriggered
- Type
Ucommerce.Pipelines.Transactions.Baskets.Checkout.FeedCampaignTriggeredTask
SendEmailTask
- Windsor component id
Checkout.SendConfirmationEmail
- Type
Ucommerce.Pipelines.Common.SendEmailTask
- Description
Sends out e-mail based on the specified e-mail type. E-mail stored on billing address is used as receiver e-mail.
Pipeline configuration
Configuration as found under ucommerce\pipelines\Baskets.Checkout.config
<configuration> <components> <!-- Pipeline Instance --> <component id="Checkout" service="Ucommerce.Pipelines.IPipeline`1[[Ucommerce.EntitiesV2.PurchaseOrder, Ucommerce]], Ucommerce" type="Ucommerce.Pipelines.Transactions.Baskets.Checkout.CheckoutPipeline, Ucommerce.Pipelines"> <parameters> <tasks> <array> <value>${Checkout.ValidatePaymentsMadeAgainstOrderTotal}</value> <value>${Checkout.AssignOrderNumber}</value> <value>${Checkout.CreateCustomer}</value> <value>${Checkout.CreateMemberForCustomer}</value> <value>${Checkout.ConvertBasketToPurchaseOrder}</value> <value>${Checkout.AddAuditTrailForCurrentOrderStatus}</value> <value>${Checkout.SetVoucherUses}</value> <value>${Checkout.ClearBasketInformation}</value> <value>${Checkout.SavePurchaseOrder}</value> <value>${Checkout.Feed.OrderPlaced}</value> <value>${Checkout.Feed.ReturningCustomer}</value> <value>${Checkout.Feed.NewCustomer}</value> <value>${Checkout.Feed.CampaignTriggered}</value> <value>${Checkout.SendConfirmationEmail}</value> </array> </tasks> </parameters> </component> <!-- Pipeline Tasks--> <component id="Checkout.ValidatePaymentsMadeAgainstOrderTotal" service="Ucommerce.Pipelines.IPipelineTask`1[[Ucommerce.EntitiesV2.PurchaseOrder, Ucommerce]], Ucommerce" type="Ucommerce.Pipelines.Transactions.Baskets.Checkout.ValidatePaymentsMadeAgainstOrderTotalTask, Ucommerce.Pipelines" /> <component id="Checkout.CreateCustomer" service="Ucommerce.Pipelines.IPipelineTask`1[[Ucommerce.EntitiesV2.PurchaseOrder, Ucommerce]], Ucommerce" type="Ucommerce.Pipelines.Transactions.Baskets.Checkout.CreateCustomerTask, Ucommerce.Pipelines"> <parameters> <createCustomerPipeline>${CreateCustomer}</createCustomerPipeline> </parameters> </component> <component id="Checkout.CreateMemberForCustomer" service="Ucommerce.Pipelines.IPipelineTask`1[[Ucommerce.EntitiesV2.PurchaseOrder, Ucommerce]], Ucommerce" type="Ucommerce.Pipelines.Transactions.Baskets.Checkout.CreateMemberForCustomerTask, Ucommerce.Pipelines" /> <component id="Checkout.AssignOrderNumber" service="Ucommerce.Pipelines.IPipelineTask`1[[Ucommerce.EntitiesV2.PurchaseOrder, Ucommerce]], Ucommerce" type="Ucommerce.Pipelines.Transactions.Baskets.Checkout.AssignOrderNumberTask, Ucommerce.Pipelines" /> <component id="Checkout.ConvertBasketToPurchaseOrder" service="Ucommerce.Pipelines.IPipelineTask`1[[Ucommerce.EntitiesV2.PurchaseOrder, Ucommerce]], Ucommerce" type="Ucommerce.Pipelines.Transactions.Baskets.Checkout.ConvertBasketToPurchaseOrderTask, Ucommerce.Pipelines" /> <component id="Checkout.SavePurchaseOrder" service="Ucommerce.Pipelines.IPipelineTask`1[[Ucommerce.EntitiesV2.PurchaseOrder, Ucommerce]], Ucommerce" type="Ucommerce.Pipelines.Common.SavePurchaseOrderTask, Ucommerce.Pipelines" /> <component id="Checkout.AddAuditTrailForCurrentOrderStatus" service="Ucommerce.Pipelines.IPipelineTask`1[[Ucommerce.EntitiesV2.PurchaseOrder, Ucommerce]], Ucommerce" type="Ucommerce.Pipelines.Common.AddAuditTrailForCurrentOrderStatusTask, Ucommerce.Pipelines" /> <component id="Checkout.ClearBasketInformation" service="Ucommerce.Pipelines.IPipelineTask`1[[Ucommerce.EntitiesV2.PurchaseOrder, Ucommerce]], Ucommerce" type="Ucommerce.Pipelines.Transactions.Baskets.Checkout.ClearBasketInformationTask, Ucommerce.Pipelines" /> <component id="Checkout.SetVoucherUses" service="Ucommerce.Pipelines.IPipelineTask`1[[Ucommerce.EntitiesV2.PurchaseOrder, Ucommerce]], Ucommerce" type="Ucommerce.Pipelines.Transactions.Baskets.Checkout.SetVoucherUsesTask, Ucommerce.Pipelines" /> <component id="Checkout.Feed.OrderPlaced" service="Ucommerce.Pipelines.IPipelineTask`1[[Ucommerce.EntitiesV2.PurchaseOrder, Ucommerce]], Ucommerce" type="Ucommerce.Pipelines.Transactions.Baskets.Checkout.FeedOrderPlacedTask, Ucommerce.Pipelines" /> <component id="Checkout.Feed.ReturningCustomer" service="Ucommerce.Pipelines.IPipelineTask`1[[Ucommerce.EntitiesV2.PurchaseOrder, Ucommerce]], Ucommerce" type="Ucommerce.Pipelines.Transactions.Baskets.Checkout.FeedReturningCustomerTask, Ucommerce.Pipelines" /> <component id="Checkout.Feed.NewCustomer" service="Ucommerce.Pipelines.IPipelineTask`1[[Ucommerce.EntitiesV2.PurchaseOrder, Ucommerce]], Ucommerce" type="Ucommerce.Pipelines.Transactions.Baskets.Checkout.FeedNewCustomerTask, Ucommerce.Pipelines" /> <component id="Checkout.Feed.CampaignTriggered" service="Ucommerce.Pipelines.IPipelineTask`1[[Ucommerce.EntitiesV2.PurchaseOrder, Ucommerce]], Ucommerce" type="Ucommerce.Pipelines.Transactions.Baskets.Checkout.FeedCampaignTriggeredTask, Ucommerce.Pipelines" /> <component id="Checkout.SendConfirmationEmail" service="Ucommerce.Pipelines.IPipelineTask`1[[Ucommerce.EntitiesV2.PurchaseOrder, Ucommerce]], Ucommerce" type="Ucommerce.Pipelines.Common.SendEmailTask, Ucommerce.Pipelines"> <parameters> <emailTypeName>OrderConfirmation</emailTypeName> </parameters> </component> </components> </configuration>
Custom task
If you're interested in creating your own pipeline task, here's a code sample and configuration below for the Checkout pipeline. If you haven't read how to create custom pipeline tasks before, we recommend giving it a read as there's a lot of valuable information covered in the article.
Code sample
using Ucommerce.Pipelines; using Ucommerce.EntitiesV2; namespace MyProject.Extensions.Pipelines.Checkout { public class MyCheckoutPipelineTask : Ucommerce.Pipelines.IPipelineTask<Ucommerce.EntitiesV2.PurchaseOrder> { public PipelineExecutionResult Execute(Ucommerce.EntitiesV2.PurchaseOrder subject) { return PipelineExecutionResult.Success; } } }
Configuration
<configuration> <components> <component id="Checkout.MyCheckoutPipelineTask" service="Ucommerce.Pipelines.IPipelineTask`1[[Ucommerce.EntitiesV2.PurchaseOrder, Ucommerce]], Ucommerce" type="MyProject.Extensions.Pipelines.Checkout.MyCheckoutPipelineTask, MyAssembly" /> <partial-component id="Checkout"> <parameters> <tasks> <array> <value insert="last">${Checkout.MyCheckoutPipelineTask}</value> </array> </tasks> </parameters> </partial-component> </components> </configuration>
The configuration above just inserts your task as the last task in the pipeline. Mind this line in the configuration above:
<value insert="last">${Checkout.MyCheckoutPipelineTask}</value>
Additionally you can insert first, or before or after a specific task. Just like the example below
You may also use insert="first"
insert-before="${Checkout.ValidatePaymentsMadeAgainstOrderTotal}"
or insert-after="${Checkout.ValidatePaymentsMadeAgainstOrderTotal}"